from django.db import models

# Create your models here.

class Autor(models.Model):
    nome = models.CharField(max_length=512, unique=True)
    nota = models.FloatField(default = 0.0)

    def __unicode__(self):
        return self.nome

class Tag(models.Model):
    nome = models.CharField(max_length=256, unique=True)
    nota = models.FloatField(default = 0.0)

    def __unicode__(self):
        return self.nome

class Citacao(models.Model):
    texto = models.TextField(unique=True)
    nota = models.FloatField(default = 0.0)
    autor = models.ForeignKey(Autor, related_name = "citacoes")
    tags = models.ManyToManyField(Tag , related_name = "citacoes")

    def __unicode__(self):
        return self.texto
